<template>
	<view class="store-wrapper" :style="[style]">
		<e-loading-page :loading="loading"  >
			<template #icon>
				<loader ></loader>
			</template>
		</e-loading-page>
		<store-layout :storeId="storeId"  :componentsList="componentsList" :onShow="hasShow" @pageBackgroundImageChange="setPageBackgroundImage"  />
	</view>
</template>

<script lang="ts">
import storeLayoutMixIn from '@/common/mixin/storeLayoutMixIn'
// 所有可被装修选中的页面的混入，用于动态修改标题，例如装修的按钮组组件，按钮的文本为xxx，跳转到对应页面时，会将页面的标题修改为xxx
import layoutPageTitleMixIn from '@/common/mixin/layoutPageTitleMixIn'
import {getStoreLayoutPage } from '@/common/request/api'
export default {
	mixins: [storeLayoutMixIn,layoutPageTitleMixIn],
	data() {
		return {
			loading:false,
			storePageId:'',
			storeId: '',
			hasShow:false
		}
	},
	onLoad(opt) {
		this.storePageId = opt.id
		this.getHomeData()
	},
	onShow() {
		this.hasShow = true
	},
	onHide() {
		this.hasShow = false
	},
	methods: {
		getHomeData () {
			this.loading = true
			getStoreLayoutPage(this.storePageId).then(res => {
				this.loading = false
				this.setPageOption(res.data)
				this.storeId = res.data.storeId
			})
		}
	}
}
</script>

<style lang="scss" scoped>
</style>
